package com.ruoyi.web.controller.pollution;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pollution.domain.BusPsBasMonitoringorganization;
import com.ruoyi.pollution.service.IBusPsBasMonitoringorganizationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 监测机构信息Controller
 * 
 * @author ruoyi
 * @date 2025-09-16
 */
@RestController
@RequestMapping("/pollution/monitoringorganization")
public class BusPsBasMonitoringorganizationController extends BaseController
{
    @Autowired
    private IBusPsBasMonitoringorganizationService busPsBasMonitoringorganizationService;

    /**
     * 查询监测机构信息列表
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGORGANIZATION:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusPsBasMonitoringorganization busPsBasMonitoringorganization)
    {
        startPage();
        List<BusPsBasMonitoringorganization> list = busPsBasMonitoringorganizationService.selectBusPsBasMonitoringorganizationList(busPsBasMonitoringorganization);
        return getDataTable(list);
    }

    /**
     * 导出监测机构信息列表
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGORGANIZATION:export')")
//    @Log(title = "监测机构信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusPsBasMonitoringorganization busPsBasMonitoringorganization)
    {
        List<BusPsBasMonitoringorganization> list = busPsBasMonitoringorganizationService.selectBusPsBasMonitoringorganizationList(busPsBasMonitoringorganization);
        ExcelUtil<BusPsBasMonitoringorganization> util = new ExcelUtil<BusPsBasMonitoringorganization>(BusPsBasMonitoringorganization.class);
        util.exportExcel(response, list, "监测机构信息数据");
    }

    /**
     * 获取监测机构信息详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGORGANIZATION:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busPsBasMonitoringorganizationService.selectBusPsBasMonitoringorganizationById(id));
    }

    /**
     * 新增监测机构信息
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGORGANIZATION:add')")
//    @Log(title = "监测机构信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusPsBasMonitoringorganization busPsBasMonitoringorganization)
    {
        return toAjax(busPsBasMonitoringorganizationService.insertBusPsBasMonitoringorganization(busPsBasMonitoringorganization));
    }

    /**
     * 修改监测机构信息
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGORGANIZATION:edit')")
//    @Log(title = "监测机构信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusPsBasMonitoringorganization busPsBasMonitoringorganization)
    {
        return toAjax(busPsBasMonitoringorganizationService.updateBusPsBasMonitoringorganization(busPsBasMonitoringorganization));
    }

    /**
     * 删除监测机构信息
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGORGANIZATION:remove')")
//    @Log(title = "监测机构信息", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busPsBasMonitoringorganizationService.deleteBusPsBasMonitoringorganizationByIds(ids));
    }
}
